package com.dto;

import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

public class RowValidateResult extends ValidateResultDto {
    private String index;
    private List<CellValidateResult> rows;

    public String getIndex() {
        return index;
    }
    public void setIndex(String index) {
        this.index = index;
    }

    public List<CellValidateResult> getRows() {
        return rows;
    }

    public void setRows(CellValidateResult cell) {
        if (rows==null){
            rows=new ArrayList<CellValidateResult>();
        }
        if (cell!=null&&cell.isValid()){
            rows.add(cell);
        }

    }

    @Override
    public String toString() {
        return "RowValidateResult{" +
                "index='" + index + '\'' +
                ", rows=" + rows +
                '}';
    }

    public boolean isValid() {
        return CollectionUtils.isNotEmpty(rows);
    }
}
